<?php
namespace Tbf\Bundle\TaskManageBundle;
use Symfony\Component\DependencyInjection\ContainerAware;

class CollectionTaskRunner extends ContainerAware implements TaskInterface
{
    /**
     * @var TaskInterface[]
     */
    protected $task_list;
    public function __construct($task_list)
    {
        $this->task_list = $task_list;
    }
    public function run()
    {
        foreach ($this->task_list as $task) {
            if ($task instanceof ContainerAware) {
                $task->setContainer($this->container);
            }
            $task->run();
        }
    }
}
